var a = getApp();

Page({
    data: {
        page: 1,
        info: []
    },
    onLoad: function(a) {
        this.getData(), wx.setNavigationBarTitle({
            title: "直播授权码"
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        if (!(this.data.current_page >= this.data.last_page)) {
            var a = this.data.page + 1;
            this.setData({
                page: a
            }), this.getMore();
        }
    },
    onShareAppMessage: function() {},
    getData: function() {
        var t = this, e = a.getNetAddresss("plugin.room.frontend.code.get-code-profit");
        a._getNetWork({
            url: e,
            data: {
                page: t.data.page
            },
            success: function(a) {
                var e = a.data;
                1 == e.result ? t.setData({
                    info: e.data.data,
                    money: e.data.money,
                    avatar: e.data.avatar,
                    nickname: e.data.nickname,
                    current_page: e.data.current_page,
                    last_page: e.data.last_page
                }) : wx.showToast({
                    title: e.msg,
                    icon: "none",
                    duration: 1500
                });
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    getMore: function() {
        var t = this, e = a.getNetAddresss("plugin.room.frontend.code.get-code-profit");
        a._getNetWork({
            url: e,
            data: {
                page: t.data.page
            },
            success: function(a) {
                var e = a.data;
                1 == e.result ? t.setData({
                    info: t.data.info.concat(e.data.data),
                    current_page: e.data.current_page,
                    last_page: e.data.last_page
                }) : wx.showToast({
                    title: e.msg,
                    icon: "none",
                    duration: 1500
                });
            },
            fail: function(a) {
                console.log(a);
            }
        });
    }
});